<template>
	<view class="tab-group">
		<view :class="{ 'ct_active': index == tabCur, 'rec_active':active_line == true && index == tabCur }"
		 v-for="(item, index) in menus" :key="index" class="tab_item"
			@click="clickCtTab(index)">
			<text v-text="item.title"></text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "TabMenu",
		props: {
			menus: {
				type: Array,
				default: []
			},
			active_line: false
		},
		data(){
			return {
				tabCur:0 
			}
		},
		methods: {
			clickCtTab(ctCur) {
				this.tabCur = ctCur
				this.$emit('clickCtTab',ctCur)
			},
		},
		onHide() {
			this.tabCur = 0
		}
	}
</script>

<style lang="scss" scoped>
	.tab-group {
		display: flex;
		justify-content: space-between;
		flex-direction: row;
		flex-wrap: nowrap;
		overflow: hidden;
		align-items: center;
		text-align: center;
		background-color: white;
		box-sizing: border-box;
		padding: 10px 0;
	}

	.tab-group .tab_item {
		flex: 1;
		flex-grow: 1;
		flex-shrink: 0;
		display: flex;
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: center;
	}

	.tab-group .tab_item {
		border-bottom: 5px solid transparent;
		font-size: 16px;
		box-sizing: border-box;
	}

	.tab-group .tab_item.ct_active {
		color: #2866f9;
		font-size: 16px;
		border-bottom: 5px solid #007AFF;
	}
	.tab-group .tab_item.rec_active
	{
		color: #FC4141;
		font-size: 16px;
		border-bottom: 5px solid #FC4141;
		border-color: #FC4141;
	}
</style>